
<?php
session_start();

echo "Hello:<input type=text name=sessionuseremail disabled=disabled value='$_SESSION[email]'>";
?>
<html>
<head>

<head>


<body bgcolor=gray>



<h1><marquee bgcolor=orange>Welcome to The SASystem</marquee></h1>


   <?php
echo "<input type=text name=ID value=" . $_POST['user'] ."> <br><br>";
$localhost = "localhost";
$user = "root";
$password = "abc123";
   $link = @mysql_connect($localhost, $user, $password);
   if(!$link){
    die("Con not connect: ". mysql_connect_error());
}
mysql_select_db("sasystemTables", $link);
echo "<form action=adduser method=post>";

   
   echo "Type Of User" . "<input type=text name=kkindofuser value=>";
   echo "Email Address" . "<input type=text name=aemail value=>";
   echo "Password" . "<input type=text name=ppassword value=>";
   echo "name" . "<input type=text name=nname value=>";
   echo "<input type=submit name=insert value=Add-new-student>" . "</td>";
   echo "<center>";
 
   echo "</center>";



echo "</form>";





if(isset($_POST['insert'])){
$InsertQ = "INSERT INTO Logins (role,userID, password, name) VALUES ('$_POST[kkindofuser]','$_POST[aemail]', '$_POST[ppassword]', '$_POST[nname]')";
mysql_query($InsertQ, $link);
};
// i'll show u how this work fine
if(isset($_POST['delete'])){
$DeletQ = "DELETE FROM Logins WHERE userID='$_POST[email]'";
mysql_query($DeletQ, $link);
};

 if(isset($_POST['update'])){

$UpdateQ = "UPDATE Logins SET role='$_POST[Kindofuser]', userID='$_POST[email]', password='$_POST[password]', name='$_POST[name]' WHERE userID='$_POST[hidden]'";
mysql_query($UpdateQ, $link);



};
   
   $result = mysql_query("SELECT * FROM Logins", $link);


echo "<table border=1>
 <tr>
    
    <th>Type of user</th>
    <th>Email</th>
    <th>Password</th>
    
 </tr>";

   while($row = mysql_fetch_array($result))
{
  echo "<form action=adduser method=post>";
   
   echo "<tr>";
   
   echo "<td>" . "<input type=text name=name value=" . $row['name'] . " </td>";
   echo "<td>" . "<input type=text name=Kindofuser value=" . $row['role'] . " </td>";
   echo "<td>" . "<input type=text name=email value=" . $row['userID'] ." </td>";
   echo "<td>" . "<input type=text name=password value=" . $row['password'] ." </td>";

   echo "<td>" . "<input type=hidden name=hidden value=" . $row['userID'] . " </td>";
   echo "<td>" . "<input type=submit name=update value=Update>" . "</td>";
   echo "<td>" . "<input type=submit name=delete value=Delete>" . "</td>";
   
   
   echo "</tr>";
   echo "</form>";

 }

echo "</table>";

mysql_close($link);

    
   //$num_rows = mysql_num_rows($result);
   //echo "$num_rows Row\n";
   ?>
 <body>
<html>
